<template>
  <div class="son">
    <h1>我是儿子存款:{{ money }}</h1>
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";

//组件内部数据对外关闭的，别人不能访问
//如果想让外部访问需要通过defineExpose方法对外暴漏
let money = ref(10000);

const run = () => {
  console.log("我可以run");
};

defineExpose({ money, run });
</script>

<style scoped>
.son {
  width: 400px;
  height: 200px;
  background: #ccc;
}
</style>
